package im.yisme.view.ui.util;

import android.graphics.Paint;

public class TextMeasure {
	 public static int getStringWidth(Paint paint, String str) {
         int iRet = 0;
         if (str != null && str.length() > 0) {
                 int len = str.length();
                 float[] widths = new float[len];
                 paint.getTextWidths(str, widths);
                 for (int j = 0; j < len; j++) {
                         iRet += (int) Math.ceil(widths[j]);
                 }
         }
         return iRet;
    }
	 public static int getStringHeight(Paint paint, String str) {
         int iRet = 0;
         if (str != null && str.length() > 0) {
                 int len = str.length();
                 float[] widths = new float[len];
                 paint.getTextWidths(str, widths);
                 for (int j = 0; j < len; j++) {
                         iRet += (int) Math.ceil(widths[j]);
                 }
         }
         return iRet;
    }
}
